package strategy;

/**
 * @Author: sijunqiang
 * @Date: 2020/5/11 10:34
 * @Description: 定义上下文 负责使用DealStrategy角色
 */
public class DealContext {


    // 定义需要传入的类型
    private String type;

    // 定义接口工厂
    private DealStrategy deal;

    //全参的构造函数
    public DealContext(String type, DealStrategy deal) {
        this.type = type;
        this.deal = deal;
    }

    // 获取策略接口工厂
    public DealStrategy getDeal() {
        return deal;
    }

    // 判断传入的类型是否是和已经加载的类型一致
    public boolean options(String type) {
        return this.type.equals(type);
    }
}
